//
//  BaseTableViewController.swift
//  我的微博
//
//  Created by yz on 15/9/6.
//  Copyright © 2015年 yz. All rights reserved.
//

import UIKit

class BaseTableViewController: UITableViewController,VisitorLoginViewDelegate {

    var userLogin = false
    var visitorView:VisitorLoginView?
    override func loadView() {
        userLogin ? super.loadView(): setupVisitorView()
        
    }

    /// 设置访客视图
    private func setupVisitorView(){

        visitorView = VisitorLoginView()
        visitorView?.delegate = self
        view = visitorView

        // 设置状态栏
        navigationItem.leftBarButtonItem = UIBarButtonItem(title: "注册", style: UIBarButtonItemStyle.Plain, target: self, action: "visitorLoginViewWillRegister")
        navigationItem.rightBarButtonItem = UIBarButtonItem(title: "登录", style: UIBarButtonItemStyle.Plain, target: self, action: "visitorLoginViewWillLogin")
    }
    // MARK: --- VisitorLoginViewDelegate
    func visitorLoginViewWillRegister() {
       print("注册")
        
    }
    func visitorLoginViewWillLogin() {
        let nav = UINavigationController(rootViewController: OAuthViewController())
        presentViewController(nav, animated: true, completion: nil)
    }
}



